home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / crt0 / sections.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-12  |  553 b   |  38 lines

  1. #include <stdio.h>
  2.  
  3. int d1 = 0x12345678;
  4. int d2 = 0x76543210;
  5. char bss[10000];
  6.  
  7. extern int end;
  8.  
  9. int
  10. main(void)
  11. {
  12.   char *c, *e;
  13.   if (d1 != 0x12345678)
  14.   {
  15.     printf ("d1 not 0x12345678\n");
  16.     return 1;
  17.   }
  18.   if (d2 != 0x76543210)
  19.   {
  20.     printf ("d1 not 0x12345678\n");
  21.     return 1;
  22.   }
  23.  
  24.   c = bss;
  25.   e = c + sizeof(bss);
  26.   printf("bss scan from %p to %p, %lu bytes\n", c, e, e-c);
  27.   while (c < e)
  28.   {
  29.     if (*c)
  30.     {
  31.       printf("non-zero bss at %p\n", c);
  32.       return 1;
  33.     }
  34.     c++;
  35.   }
  36.   return 0;
  37. }
  38.